﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace SportingGoodsExhibitionSystem
{
    /// <summary>
    /// AdminPeoInfo.xaml 的交互逻辑
    /// </summary>
    public partial class AdminPeoInfo : Window
    {
        public AdminPeoInfo()
        {
            InitializeComponent();
        }
        int stuNum;
        public AdminPeoInfo(int stuNum)
        {
            InitializeComponent();
            this.stuNum = stuNum;
        }

        string strCon = Properties.Resources.strCON;

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SqlConnection con = new SqlConnection(strCon);
            con.Open();
            SqlCommand cmd = new SqlCommand("select * from peoInfo where stunum=@num", con);
            cmd.Parameters.Add("@num", SqlDbType.Int, 10).Value = stuNum;
            SqlDataAdapter read = new SqlDataAdapter(cmd);
            //DataTable dt = new DataTable();
            DataSet dataset = new DataSet();
            read.Fill(dataset);
            DataTable table = dataset.Tables[0];
            DataRowCollection rows = table.Rows;
            DataRow row = rows[0];
            peoname1.Content = row["fpeoname"].ToString();
            peotele1.Content = row["fpeotele"].ToString(); ;
            
            peoname2.Content = row["speoname"].ToString();
            peotele2.Content = row["speotele"].ToString();

            int a = Convert.ToInt32(row["wfhea"].ToString());
            int b = Convert.ToInt32(row["wshea"].ToString());

            if (a == 1)
            {
                peohea1.Content = "是";
            }
            else
            {
                peohea1.Content = "否";
            }

            if (b == 1)
            {
                peohea2.Content = "是";
            }
            else
            {
                peohea2.Content = "否";
            }

            con.Close();
        }
    }
}
